#pragma once

#include <GL\glui.h>
#include <string>
#include <vector>

using namespace std;


class Transformation
{
public:
	virtual void apply()=0;
};

class Translate : public Transformation
{
public:
	Translate(){}
	Translate(float _x, float _y, float _z):
	  x(_x),y(_y),z(_z) {}
	float x;
	float y;
	float z;
	void apply() { glTranslated(x,y,z); }
};

class Rotate : public Transformation
{
public:
	Rotate(){}
	Rotate(char _axis,float _angle):
	  axis(_axis),angle(_angle) {}
	char axis;
	float angle;
	void apply() 
	{ 
		switch (axis)
		{
			case 'x':
				glRotated(angle,1,0,0);
				break;
			case 'y':
				glRotated(angle,0,1,0);
				break;
			case 'z':
				glRotated(angle,0,0,1);
				break;
		}
	}
};

class Scale : public Transformation
{
public:
	Scale(){}
	Scale(float _x, float _y, float _z):
	  x(_x),y(_y),z(_z) {}
	float x;
	float y;
	float z;
	void apply() { glScaled(x,y,z); }
};



class TransformationSet 
{
public:
	TransformationSet(){}
	TransformationSet(string _id):
		id(_id) {}

	string id;
	vector<Transformation* > transformacoes;
	void apply(){

		for(unsigned int i=0; i<transformacoes.size(); ++i)
		//for(unsigned int i=transformacoes.size()-1; i!=-1; --i)
		{
			transformacoes[i]->apply();
		}
	}
};